package com.cqc.preferenceactivity01;

import android.preference.PreferenceActivity;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.Button;

import java.util.List;

public class Main3Activity extends PreferenceActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        if (hasHeaders()) {
            Button button = new Button(this);
            button.setText("Some action");
            setListFooter(button);
        }
    }


    /**
     * 若使用了Fragment，必须重写该方法
     */
    @Override
    protected boolean isValidFragment(String fragmentName) {
        return true;
    }

    /**
     * 创建header
     */
    @Override
    public void onBuildHeaders(List<Header> target) {
        loadHeadersFromResource(R.xml.pre_header, target);
    }

}
